package com.compass.doctor.ui.home.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import com.compass.doctor.R
import com.compass.doctor.databinding.LayoutExigencyMenuItemBinding
import com.compass.framework.adapter.BaseBindViewHolder
import com.compass.framework.adapter.BaseRecyclerViewAdapter
import com.compass.framework.model.Dictionaries
import com.compass.framework.utils.getColorFromResource

/**
 * Description： 紧急代办标签
 * Date:2023/12/8 14:43
 */
class ExigencyMenuAdapter : BaseRecyclerViewAdapter<Dictionaries, LayoutExigencyMenuItemBinding>() {
    override fun onBindDefViewHolder(
        holder: BaseBindViewHolder<LayoutExigencyMenuItemBinding>,
        item: Dictionaries?,
        position: Int
    ) {
        if (item == null) return
        holder.binding.apply {
            actionText.text = item.label
            if (item.isSelect){
                actionText.setTextColor(getColorFromResource(R.color.color_5795ff))
            }else{
                actionText.setTextColor(getColorFromResource(R.color.color_2e344a))
            }

        }
    }

    override fun getViewBinding(
        layoutInflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): LayoutExigencyMenuItemBinding {
        return LayoutExigencyMenuItemBinding.inflate(layoutInflater, parent, false)
    }
}